package gases.as3.librarys.components.containui
{
	import gases.as3.librarys.components.skin.data.BaseSkin;
	import gases.as3.librarys.components.ui.GUIComponents;
	import gases.as3.librarys.components.ui.basic.GLabel;
	import gases.as3.librarys.components.ui.control.GButton;
	import gases.as3.librarys.components.ui.control.GLabelButton;
	
	public class ButtonItem extends GUIComponents
	{
		public function ButtonItem(style:int=1,labeltxt:String = "",width:Number = 120,height:Number = 20,
								 size:int=12,labelcolor:uint=0x00FF00,btntxt:String = "",btnColor:uint = 0xFFFFFF)
		{
			_style = style;
			_labelTxt = labeltxt;
			_btnTxt = btntxt;
			_labelColor = labelcolor;
			_btnColor = btnColor;
			_size = size;
			_width = width;
			_height = height;
			super();
		}
		
		override protected function initialization():void
		{
			super.initialization();
			
			_label = new GLabel(_labelTxt,_labelColor,_size,_width,_height);
			_btn = new GLabelButton(_btnTxt,_btnColor);
			
			this.addChild(_label);
			this.addChild(_btn);
			
			setStyle();
		}
		
		public function setSkin(btnSkin:BaseSkin):void
		{
			_btn.skin = btnSkin;
		}
		
		
		public function setLabelTxt(value:String):void
		{
			_label.text = value;
		}
		
		public function setBtnTxt(value:String):void
		{
			_btn.text = value;
		}
		
		private function setStyle():void
		{
			switch(_style)
			{
				case 1:
					_btn.x = _label.Gwidth + 1;
					break;
				case 2:
					_label.x = _btn.Gwidth + 1;
					break;
			}
		}
		
		
		private var _labelTxt:String;
		private var _btnTxt:String;
		private var _width:Number;
		private var _height:Number;
		private var _size:int;
		private var _labelColor:uint;
		private var _btnColor:uint;
		
		private var _style:int;
		
		private var _label:GLabel;
		private var _btn:GLabelButton;
	}
}